package design.test2Proxy.dynamicproxy2;

import java.lang.reflect.Proxy;

public class ProxyFactory {
    public static PersonService getInstance(){
        PersonService personService=new PersonServiceImpl();
        ObjectInvocationHandler handler=new ObjectInvocationHandler(personService);
        PersonService proxy = (PersonService)Proxy.newProxyInstance(personService.getClass().getClassLoader(), personService.getClass().getInterfaces(), handler);
        return proxy;
    }
}
